<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>quick-cocos2d-x API Documents - framework.client.display</title>
<link rel="stylesheet" href="luadocx-style.css" type="text/css" />
<link rel="stylesheet" href="luadocx-style-monokai.css" type="text/css" />
<script src="luadocx-highlight.min.js"></script>
<script type="text/javascript" charset="utf-8">hljs.initHighlightingOnLoad();</script>
</head>
<body>
  <div id="container">

    <table id="main">
      <tr>
        <td id="navigation">

          <h2>Links</h2>
          <ul>
            <li><a href="index.html">Index</a></li>
          </ul>

          <h2>Modules</h2>
          <ul>
            <li><a href="index.html">framework.init</a></li>
            <li><a href="framework.client.api.context.html">framework.client.api.Context</a></li>
            <li><a href="framework.client.api.eventprotocol.html">framework.client.api.EventProtocol</a></li>
            <li><a href="framework.client.api.gamenetwork.html">framework.client.api.GameNetwork</a></li>
            <li><a href="framework.client.api.gamestate.html">framework.client.api.GameState</a></li>
            <li><a href="framework.client.api.localize.html">framework.client.api.Localize</a></li>
            <li><a href="framework.client.api.store.html">framework.client.api.Store</a></li>
            <li><a href="framework.client.api.timer.html">framework.client.api.Timer</a></li>
            <li><a href="framework.client.api.gamenetwork.openfeint.html">framework.client.api.gamenetwork.OpenFeint</a></li>
            <li><a href="framework.client.audio.html">framework.client.audio</a></li>
            <li><a href="framework.client.crypto.html">framework.client.crypto</a></li>
            <li><a href="framework.client.device.html">framework.client.device</a></li>
            <li><strong>framework.client.display</strong></li>
            <li><a href="framework.client.init.html">framework.client.init</a></li>
            <li><a href="framework.client.luaj.html">framework.client.luaj</a></li>
            <li><a href="framework.client.luaoc.html">framework.client.luaoc</a></li>
            <li><a href="framework.client.network.html">framework.client.network</a></li>
            <li><a href="framework.client.scheduler.html">framework.client.scheduler</a></li>
            <li><a href="framework.client.transition.html">framework.client.transition</a></li>
            <li><a href="framework.client.ui.html">framework.client.ui</a></li>
            <li><a href="framework.server.mysqleasy.html">framework.server.MysqlEasy</a></li>
            <li><a href="framework.server.rediseasy.html">framework.server.RedisEasy</a></li>
            <li><a href="framework.server.serveraction.html">framework.server.ServerAction</a></li>
            <li><a href="framework.server.serverapp.html">framework.server.ServerApp</a></li>
            <li><a href="framework.server.session.html">framework.server.Session</a></li>
            <li><a href="framework.server.init.html">framework.server.init</a></li>
            <li><a href="framework.shared.modelbase.html">framework.shared.ModelBase</a></li>
            <li><a href="framework.shared.debug.html">framework.shared.debug</a></li>
            <li><a href="framework.shared.errors.html">framework.shared.errors</a></li>
            <li><a href="framework.shared.functions.html">framework.shared.functions</a></li>
          </ul>

        </td> <!-- navigation -->

        <td id="content">

          <h1>Module <code>framework.client.display</code></h1>

          <!-- BEGIN module doc -->

          <div id="module_doc">

<p>The display module provides access to cocos2d-x core features.</p>

<ul>
<li>Query display screen information.</li>
<li>Mange scenes.</li>
<li>Creates display objects.</li>
</ul>

<br />


          </div>

          <!-- END module doc -->


          <!--  BEGIN functions index -->

          <h2>Functions</h2>
          <table class="function_list">


            <tr>
              <td class="name" nowrap><a href="#anchor_display_setTexturePixelFormat">display.setTexturePixelFormat&nbsp;(filename,&nbsp;format)</a></td>
              <td class="summary"></td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newScene">display.newScene&nbsp;(name)</a></td>
              <td class="summary">Creates a scene.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_wrapSceneWithTransition">display.wrapSceneWithTransition&nbsp;(scene,&nbsp;transitionType,&nbsp;time,&nbsp;more)</a></td>
              <td class="summary"></td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_replaceScene">display.replaceScene&nbsp;(newScene,&nbsp;transitionType,&nbsp;time,&nbsp;more)</a></td>
              <td class="summary">Replaces the running scene with a new one.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_getRunningScene">display.getRunningScene&nbsp;()</a></td>
              <td class="summary">Get current running scene.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_pause">display.pause&nbsp;()</a></td>
              <td class="summary">Pauses the running scene.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_resume">display.resume&nbsp;()</a></td>
              <td class="summary">Resumes the paused scene.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newLayer">display.newLayer&nbsp;()</a></td>
              <td class="summary">Creates CCLayer object.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newNode">display.newNode&nbsp;()</a></td>
              <td class="summary">Creates a node object.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newClippingRegionNode">display.newClippingRegionNode&nbsp;(rect)</a></td>
              <td class="summary"></td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newSprite">display.newSprite&nbsp;(filename,&nbsp;x,&nbsp;y)</a></td>
              <td class="summary">Creates a CCSprite object.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newBackgroundSprite">display.newBackgroundSprite&nbsp;(filename)</a></td>
              <td class="summary">Creates a sprite, set position to screen center.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newBackgroundTilesSprite">display.newBackgroundTilesSprite&nbsp;(filename)</a></td>
              <td class="summary">Creates a sprite, repeat sprite's texture to fill whole rect.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newCircle">display.newCircle&nbsp;(radius)</a></td>
              <td class="summary">Creates a CCCircleShape object, draw a circle on screen.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newRect">display.newRect&nbsp;(width,&nbsp;height)</a></td>
              <td class="summary">Creates a CCRectShape object, draw a rectangle on screen.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newPolygon">display.newPolygon&nbsp;(points,&nbsp;scale)</a></td>
              <td class="summary">Creates a CCPolygon object, draw a polygon on screen.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_align">display.align&nbsp;(target,&nbsp;anchorPoint,&nbsp;x,&nbsp;y)</a></td>
              <td class="summary"></td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_pixels">display.pixels&nbsp;(x,&nbsp;y)</a></td>
              <td class="summary"></td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_addSpriteFramesWithFile">display.addSpriteFramesWithFile&nbsp;(plistFilename,&nbsp;image)</a></td>
              <td class="summary">Adds multiple Sprite Frames from image and plist file.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_removeSpriteFramesWithFile">display.removeSpriteFramesWithFile&nbsp;(plistFilename,&nbsp;imageName)</a></td>
              <td class="summary">Removes multiple Sprite Frames from a plist file.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_removeSpriteFrameByImageName">display.removeSpriteFrameByImageName&nbsp;(imageName)</a></td>
              <td class="summary"></td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newBatchNode">display.newBatchNode&nbsp;(image,&nbsp;capacity)</a></td>
              <td class="summary">Creates CCSpriteBatchNode object from an image.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newSpriteFrame">display.newSpriteFrame&nbsp;(frameName)</a></td>
              <td class="summary">Returns an Sprite Frame that was previously added.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newSpriteWithFrame">display.newSpriteWithFrame&nbsp;(frame,&nbsp;x,&nbsp;y)</a></td>
              <td class="summary">### Example:</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newFrames">display.newFrames&nbsp;(pattern,&nbsp;begin,&nbsp;length,&nbsp;isReversed)</a></td>
              <td class="summary">Creates multiple frames by pattern.</td>
            </tr>


            <tr>
              <td class="name" nowrap><a href="#anchor_display_newAnimation">display.newAnimation&nbsp;(frames,&nbsp;time)</a></td>
              <td class="summary">create animation</td>
            </tr>


          </table>

          <!--  END functions index -->

          <br />
          <br />

          <!-- BEGIN functions details -->

          <h2>Functions</h2>
          <dl class="function">


            <dt class="">
              <a name="anchor_display_setTexturePixelFormat"></a>
              <h3>display.setTexturePixelFormat (filename, format)</h3>
            </dt>

            <dd class="">



            </dd>


            <dt class="">
              <a name="anchor_display_newScene"></a>
              <h3>display.newScene (name)</h3>
            </dt>

            <dd class="">

<p>Creates a scene.</p>

<p>A scene (implemented with the CCScene object) is more or less an independent piece of the app workflow. Some people may call them “screens” or “stages”. Your app can have many scenes, but only one of them is active at a given time.</p>

<h3>Example:</h3>


<pre><code class="lua">local scene = display.newScene("HelloScene")
display.replaceScene(scene) -- setup running scene
</code></pre>

<h3>Parameters:</h3>

<ul>
<li>[<em>optional string <strong>name</strong></em>] name of scene</li>
</ul>

<h3>Returns:</h3>

<ul>
<li>CCScene</li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_wrapSceneWithTransition"></a>
              <h3>display.wrapSceneWithTransition (scene, transitionType, time, more)</h3>
            </dt>

            <dd class="">



            </dd>


            <dt class="">
              <a name="anchor_display_replaceScene"></a>
              <h3>display.replaceScene (newScene, transitionType, time, more)</h3>
            </dt>

            <dd class="">

<p>Replaces the running scene with a new one.</p>

<h3>Example:</h3>


<pre><code class="lua">display.replaceScene(scene1)
display.replaceScene(scene2, "CROSSFADE", 0.5)
display.replaceScene(scene3, "FADE", 0.5, ccc3(255, 255, 255))
</code></pre>

<h3>Parameters:</h3>

<ul>
<li><p>CCScene <strong>newScene</strong> scene of want to display</p></li>
<li><p>[<em>optional string <strong>transitionType</strong></em>] is one of the following:</p>

<table>
<thead>
<tr>
  <th>Transition Type</th>
  <th>Note</th>
</tr>
</thead>
<tbody>
<tr>
  <td>CROSSFADE</td>
  <td>Cross fades two scenes using the CCRenderTexture object</td>
</tr>
<tr>
  <td>FADE</td>
  <td>Fade out the outgoing scene and then fade in the incoming scene</td>
</tr>
<tr>
  <td>FADEBL</td>
  <td>Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner</td>
</tr>
<tr>
  <td>FADEDOWN</td>
  <td>Fade the tiles of the outgoing scene from the top to the bottom</td>
</tr>
<tr>
  <td>FADETR</td>
  <td>Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner</td>
</tr>
<tr>
  <td>FADEUP</td>
  <td>Fade the tiles of the outgoing scene from the bottom to the top</td>
</tr>
<tr>
  <td>FLIPANGULAR</td>
  <td>Flips the screen half horizontally and half vertically</td>
</tr>
<tr>
  <td>FLIPX</td>
  <td>Flips the screen horizontally</td>
</tr>
<tr>
  <td>FLIPY</td>
  <td>Flips the screen vertically</td>
</tr>
<tr>
  <td>JUMPZOOM</td>
  <td>Zoom out and jump the outgoing scene, and then jump and zoom in the incoming</td>
</tr>
<tr>
  <td>MOVEINB</td>
  <td>Move in from to the bottom the incoming scene</td>
</tr>
<tr>
  <td>MOVEINL</td>
  <td>Move in from to the left the incoming scene</td>
</tr>
<tr>
  <td>MOVEINR</td>
  <td>Move in from to the right the incoming scene</td>
</tr>
<tr>
  <td>MOVEINT</td>
  <td>Move in from to the top the incoming scene</td>
</tr>
<tr>
  <td>PAGETURN</td>
  <td>A transition which peels back the bottom right hand corner of a scene to transition to the scene beneath it simulating a page turn</td>
</tr>
<tr>
  <td>ROTOZOOM</td>
  <td>Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming</td>
</tr>
<tr>
  <td>SHRINKGROW</td>
  <td>Shrink the outgoing scene while grow the incoming scene</td>
</tr>
<tr>
  <td>SLIDEINB</td>
  <td>Slide in the incoming scene from the bottom border</td>
</tr>
<tr>
  <td>SLIDEINL</td>
  <td>Slide in the incoming scene from the left border</td>
</tr>
<tr>
  <td>SLIDEINR</td>
  <td>Slide in the incoming scene from the right border</td>
</tr>
<tr>
  <td>SLIDEINT</td>
  <td>Slide in the incoming scene from the top border</td>
</tr>
<tr>
  <td>SPLITCOLS</td>
  <td>The odd columns goes upwards while the even columns goes downwards</td>
</tr>
<tr>
  <td>SPLITROWS</td>
  <td>The odd rows goes to the left while the even rows goes to the right</td>
</tr>
<tr>
  <td>TURNOFFTILES</td>
  <td>Turn off the tiles of the outgoing scene in random order</td>
</tr>
<tr>
  <td>ZOOMFLIPANGULAR</td>
  <td>Flips the screen half horizontally and half vertically doing a little zooming out/in</td>
</tr>
<tr>
  <td>ZOOMFLIPX</td>
  <td>Flips the screen horizontally doing a zoom out/in The front face is the outgoing scene and the back face is the incoming scene</td>
</tr>
<tr>
  <td>ZOOMFLIPY</td>
  <td>Flips the screen vertically doing a little zooming out/in The front face is the outgoing scene and the back face is the incoming scene</td>
</tr>
</tbody>
</table></li>
<li><p>[<em>optional float <strong>time</strong></em>] duration of the transition</p></li>
<li><p>[<em>optional mixed <strong>more</strong></em>] parameter for the transition</p></li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_getRunningScene"></a>
              <h3>display.getRunningScene ()</h3>
            </dt>

            <dd class="">

<p>Get current running scene.</p>

<h3>Returns:</h3>

<ul>
<li>CCScene</li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_pause"></a>
              <h3>display.pause ()</h3>
            </dt>

            <dd class="">

<p>Pauses the running scene.</p>

            </dd>


            <dt class="">
              <a name="anchor_display_resume"></a>
              <h3>display.resume ()</h3>
            </dt>

            <dd class="">

<p>Resumes the paused scene.</p>

            </dd>


            <dt class="">
              <a name="anchor_display_newLayer"></a>
              <h3>display.newLayer ()</h3>
            </dt>

            <dd class="">

<p>Creates CCLayer object.</p>

<p>CCLayer is a subclass of CCNode. all features from CCNode are valid, plus the following new features:</p>

<ul>
<li>It can receive touches</li>
<li>It can receive Accelerometer input</li>
<li>It can receive device hardward keypad input</li>
</ul>

<h3>Example:</h3>


<pre><code class="lua">local function onTouch(event, x, y)
    printf("touch %s, x = %0.2f, y = %0.2f", event, x, y)
end

local layer = display.newLayer()
layer:addTouchEventListener(onTouch)
layer:setTouchEnabled(true)
</code></pre>

<h3>Returns:</h3>

<ul>
<li>CCLayer</li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_newNode"></a>
              <h3>display.newNode ()</h3>
            </dt>

            <dd class="">

<p>Creates a node object.</p>

<p>Anything thats gets drawn or contains things that get drawn is a CCNode. The most popular CCNodes are: CCScene, CCLayer, CCSprite, CCMenu.</p>

<p>A CCNode is a "void" object. It doesn't have a texture</p>

<p>The main features of a CCNode are:</p>

<ul>
<li>They can contain other CCNode nodes (addChild, getChildByTag, removeChild, etc)</li>
<li>They can schedule periodic callback (schedule, unschedule, etc)</li>
<li>They can execute actions (runAction, stopAction, etc)</li>
</ul>

<p>Features of CCNode:</p>

<ul>
<li>position</li>
<li>scale (x, y)</li>
<li>rotation (in degrees, clockwise)</li>
<li>CCGridBase (to do mesh transformations)</li>
<li>anchor point</li>
<li>size</li>
<li>visible</li>
<li>z-order</li>
</ul>

<h3>Example:</h3>


<pre><code class="lua">local group = display.newNode()     -- create container
group:addChild(sprite1)             -- add sprites to container
group:addChild(sprite2)             -- add sprites to container
transition.moveBy(group, {time = 2.0, x = 100})
</code></pre>

<h3>Returns:</h3>

<ul>
<li>CCNode</li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_newClippingRegionNode"></a>
              <h3>display.newClippingRegionNode (rect)</h3>
            </dt>

            <dd class="">



            </dd>


            <dt class="">
              <a name="anchor_display_newSprite"></a>
              <h3>display.newSprite (filename, x, y)</h3>
            </dt>

            <dd class="">

<p>Creates a CCSprite object.</p>

<p>CCSprite can be created with an image, or with a sprite frame.</p>

<h3>Example:</h3>


<pre><code class="lua">-- create with an image
local sprite1 = display.newSprite("hello1.png")

-- create with a sprite frame
local sprite2 = display.newSprite("#frame0001.png")
</code></pre>

<h3>Parameters:</h3>

<ul>
<li><p>string <strong>filename</strong> image filename or sprite frame name. sprite frame name have prefix character '#'.</p></li>
<li><p>[<em>optional float <strong>x</strong>, float <strong>y</strong></em>] initial position or the sprite</p></li>
</ul>

<h3>Returns:</h3>

<ul>
<li>CCSprite</li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_newBackgroundSprite"></a>
              <h3>display.newBackgroundSprite (filename)</h3>
            </dt>

            <dd class="">

<p>Creates a sprite, set position to screen center.</p>

<h3>Parameters:</h3>

<ul>
<li>string <strong>filename</strong> image filename or sprite frame name.</li>
</ul>

<h3>Returns:</h3>

<ul>
<li>CCSprite</li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_newBackgroundTilesSprite"></a>
              <h3>display.newBackgroundTilesSprite (filename)</h3>
            </dt>

            <dd class="">

<p>Creates a sprite, repeat sprite's texture to fill whole rect.</p>

<h3>Parameters:</h3>

<ul>
<li>string <strong>filename</strong> image filename or sprite frame name.</li>
</ul>

<h3>Returns:</h3>

<ul>
<li>CCSprite</li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_newCircle"></a>
              <h3>display.newCircle (radius)</h3>
            </dt>

            <dd class="">

<p>Creates a CCCircleShape object, draw a circle on screen.</p>

<p>CCCircleShape is a subclass of CCShapeNode.</p>

<p>CCShapeNode is a subclass of CCNode. all features from CCNode are valid, plus the following new features:</p>

<ul>
<li>draw shape to screen</li>
<li>set shape line color</li>
<li>set shape line width</li>
</ul>

<p>CCShapeNode have the following new methods:</p>

<ul>
<li>ccColor4F getColor()</li>
<li>setColor(ccColor4F color)</li>
<li>int getLineWidth()</li>
<li>setLineWidth(int width)</li>
</ul>

<p>CCCircleShape have the following new methods:</p>

<ul>
<li>float getRadius()</li>
<li>setRadius(float radius)</li>
<li>float getAngle()</li>
<li>setAngle(float angle)</li>
<li>int getSegments()</li>
<li>setSegments(int segments)</li>
<li>bool isDrawLineToCenter()</li>
<li>setDrawLineToCenter(bool drawLineToCenter)</li>
<li>float getScaleX()</li>
<li>setScaleX(float scaleX)</li>
<li>float getScaleY()</li>
<li>setScaleY(float scaleY)</li>
</ul>

<h3>Example:</h3>


<pre><code class="lua">local circle = display.newCircle(100) -- raidus = 100 points
circle:setColor(255, 255, 255)        -- RGB = 0xffffff, white color
circle:setSegments(128)               -- more segments appear smoother, default 32
circle:setScaleY(0.8)                 -- Draw an ellipse
</code></pre>

<h3>Parameters:</h3>

<ul>
<li>float <strong>radius</strong></li>
</ul>

<h3>Returns:</h3>

<ul>
<li>CCCircleShape</li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_newRect"></a>
              <h3>display.newRect (width, height)</h3>
            </dt>

            <dd class="">

<p>Creates a CCRectShape object, draw a rectangle on screen.</p>

<p>CCRectShape is a subclass of CCShapeNode, see <a href="#anchor_display_newCircle">display.newCircle()</a> .</p>

<p>CCRectShape have the following new methods:</p>

<ul>
<li>setSize(const CCSize&amp; size)</li>
<li>bool isFill()</li>
<li>setFill(bool isFill)</li>
</ul>

<h3>Example:</h3>


<pre><code class="lua">local rect = display.newRect(200, 100)
rect:setFill(true)
</code></pre>

<h3>Parameters:</h3>

<ul>
<li>float <strong>width</strong>, float <strong>height</strong> size of rectangle</li>
</ul>

<h3>Returns:</h3>

<ul>
<li>CCRectShape</li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_newPolygon"></a>
              <h3>display.newPolygon (points, scale)</h3>
            </dt>

            <dd class="">

<p>Creates a CCPolygon object, draw a polygon on screen.</p>

<p>CCPolygon is a subclass of CCShapeNode, see <a href="#anchor_display_newCircle">display.newCircle()</a> .</p>

<p>CCPolygon have the following new methods:</p>

<ul>
<li>bool isFill()</li>
<li>setFill(bool isFill)</li>
<li>bool isClose()</li>
<li>setClose(bool isClose)</li>
</ul>

<h3>Example:</h3>


<pre><code class="lua">local points = {
    {10, 10},  -- point 1
    {50, 50},  -- point 2
    {100, 10}, -- point 3
}
local polygon = display.newPolygon(points) -- draw a triangle
polygon:setClose(true) -- draw line from last point to first point
</code></pre>

<h3>Parameters:</h3>

<ul>
<li><p>table <strong>points</strong> array of points</p></li>
<li><p>[<em>optional float <strong>scale</strong></em>]</p></li>
</ul>

<h3>Returns:</h3>

<ul>
<li>CCPolygonShape</li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_align"></a>
              <h3>display.align (target, anchorPoint, x, y)</h3>
            </dt>

            <dd class="">



            </dd>


            <dt class="">
              <a name="anchor_display_pixels"></a>
              <h3>display.pixels (x, y)</h3>
            </dt>

            <dd class="">



            </dd>


            <dt class="">
              <a name="anchor_display_addSpriteFramesWithFile"></a>
              <h3>display.addSpriteFramesWithFile (plistFilename, image)</h3>
            </dt>

            <dd class="">

<p>Adds multiple Sprite Frames from image and plist file.</p>

<p>Creates sprite sheet tools:</p>

<ul>
<li><a href="http://www.codeandweb.com/texturepacker">Texture Packer</a></li>
<li><a href="http://www.zwopple.com/zwoptex/">Zwoptex</a></li>
</ul>

<h3>Example:</h3>


<pre><code class="lua">display.addSpriteFramesWithFile("sprites.plist", "sprites.png")
local sprite1 = display.newSprite("#sprite0001.png")
</code></pre>

<h3>Parameters:</h3>

<ul>
<li><p>string <strong>plistFilename</strong> filename of plist file</p></li>
<li><p>string <strong>image</strong> filename of image</p></li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_removeSpriteFramesWithFile"></a>
              <h3>display.removeSpriteFramesWithFile (plistFilename, imageName)</h3>
            </dt>

            <dd class="">

<p>Removes multiple Sprite Frames from a plist file.</p>

<p>Sprite Frames stored in this file will be removed. It is convinient to call this method when a specific texture needs to be removed.</p>

<h3>Parameters:</h3>

<ul>
<li>string <strong>plistFilename</strong> filename of plist file</li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_removeSpriteFrameByImageName"></a>
              <h3>display.removeSpriteFrameByImageName (imageName)</h3>
            </dt>

            <dd class="">



            </dd>


            <dt class="">
              <a name="anchor_display_newBatchNode"></a>
              <h3>display.newBatchNode (image, capacity)</h3>
            </dt>

            <dd class="">

<p>Creates CCSpriteBatchNode object from an image.</p>

<p>CCSpriteBatchNode is like a batch node: if it contains children, it will draw them in 1 single OpenGL call (often known as "batch draw").</p>

<p>A CCSpriteBatchNode can reference one and only one texture (one image file, one texture atlas). Only the CCSprites that are contained in that texture can be added to the CCSpriteBatchNode. All CCSprites added to a CCSpriteBatchNode are drawn in one OpenGL ES draw call. If the CCSprites are not added to a CCSpriteBatchNode then an OpenGL ES draw call will be needed for each one, which is less efficient.</p>

<p>Limitations:</p>

<ul>
<li>The only object that is accepted as child (or grandchild, grand-grandchild, etc...) is CCSprite or any subclass of CCSprite. eg: particles, labels and layer can't be added to a CCSpriteBatchNode.</li>
<li>Either all its children are Aliased or Antialiased. It can't be a mix. This is because "alias" is a property of the texture, and all the sprites share the same texture.</li>
</ul>

<h3>Example:</h3>


<pre><code class="lua">local imageName = "sprites.png"
display.addSpriteFramesWithFile("sprites.plist", imageName) -- load sprite frames

-- it will draw them in 1 single OpenGL call
local batch = display.newBatch(imageName)
for i = 1, 100 do
    local sprite = display.newSprite("#sprite0001.png")
    batch:addChild(sprite)
end

--

-- it will draw them use 100 OpenGL call
local group = display.newNode()
for i = 1, 100 do
    local sprite = display.newSprite("#sprite0001.png")
    group:addChild(sprite)
end
</code></pre>

<h3>Parameters:</h3>

<ul>
<li><p>string <strong>image</strong> filename of image</p></li>
<li><p>[<em>optional int <strong>capacity</strong></em>] estimated capacity of batch</p></li>
</ul>

<h3>Returns:</h3>

<ul>
<li>CCSpriteBatchNode</li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_newSpriteFrame"></a>
              <h3>display.newSpriteFrame (frameName)</h3>
            </dt>

            <dd class="">

<p>Returns an Sprite Frame that was previously added.</p>

<h3>Example:</h3>


<pre><code class="lua">display.addSpriteFramesWithFile("sprites.plist", "sprites.png")
local sprite = display.newSprite("#sprite0001")

local frame2 = display.newSpriteFrame("sprite0002.png")
local frame3 = display.newSpriteFrame("sprite0003.png")

....

sprite:setDisplayFrame(frame2)  -- change sprite texture without recreate
-- or
sprite:setDisplayFrame(frame3)
</code></pre>

<h3>Parameters:</h3>

<ul>
<li>string <strong>frameName</strong> name of sprite frame, without prefix character '#'.</li>
</ul>

<h3>Returns:</h3>

<ul>
<li>CCSpriteFrame</li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_newSpriteWithFrame"></a>
              <h3>display.newSpriteWithFrame (frame, x, y)</h3>
            </dt>

            <dd class="">

<h3>Example:</h3>

<h3>Parameters:</h3>

<h3>Returns:</h3>

            </dd>


            <dt class="">
              <a name="anchor_display_newFrames"></a>
              <h3>display.newFrames (pattern, begin, length, isReversed)</h3>
            </dt>

            <dd class="">

<p>Creates multiple frames by pattern.</p>

<h3>Example:</h3>


<pre><code class="lua">-- create array of CCSpriteFrame [walk0001.png -&gt; walk0020.png]
local frames = display.newFrames("walk%04d.png", 1, 20)
</code></pre>

<h3>Parameters:</h3>

<ul>
<li><p>string <strong>pattern</strong></p></li>
<li><p>int <strong>begin</strong></p></li>
<li><p>int <strong>length</strong></p></li>
<li><p>[<em>optional bool <strong>isReversed</strong></em>]</p></li>
</ul>

<h3>Returns:</h3>

<ul>
<li>table</li>
</ul>

            </dd>


            <dt class="">
              <a name="anchor_display_newAnimation"></a>
              <h3>display.newAnimation (frames, time)</h3>
            </dt>

            <dd class="">

<p>create animation</p>

<h3>Example:</h3>


<pre><code class="lua">display.newAnimation(frames, time)
</code></pre>

<h3>Example:</h3>


<pre><code class="lua">local frames    = display.newFrames("walk_%02d.png", 1, 20)
local animation = display.newAnimation(frames, 0.5 / 20) -- 0.5s play 20 frames
</code></pre>

            </dd>


          </dl>

          <!-- BEGIN functions details -->


      </td> <!-- id="content" -->

      </tr>
    </table> <!-- id="main" -->

    <div id="about">
      <i>update: 2013-05-08 09:30:25, generated by <a href="http://github.com/dualface/luadocx">luadocx 1.1</a></i>
    </div> <!-- id="about" -->

  </div> <!-- id="container" -->

</body>
</html>
